package com.boarsoft.boar.config.service;

import com.boarsoft.bean.ReplyInfo;

import java.io.FileNotFoundException;
import java.io.IOException;

public interface ConfigFileService {

	/**
	 * 
	 * @param by
	 * @param fileId
	 * @param env
	 * @param group
	 * @param key
	 * @param search
	 * @param replacement
	 * @return
	 */
	ReplyInfo<Object> replacePropVar(String by, String fileId, String env, String group, String key, String search,
			String replacement);

	/**
	 * 将存储在本地的配置文件下发给依赖它的应用的全部实例或实例分组
	 * 
	 * @param id
	 *            fileVersionId
	 * @param group
	 * @return
	 * @throws IllegalAccessException
	 */
	ReplyInfo<Object> sync(String id, String group) throws IllegalAccessException;

	/**
	 * 将存储在本地的配置文件下发给指定的（依赖它的）应用的全部实例或实例分组
	 * 
	 * @param id
	 *            fileVersionId
	 * @param appId
	 * @param group
	 * @return
	 * @throws IllegalAccessException
	 */
	ReplyInfo<Object> sync(String id, String appId, String group) throws IllegalAccessException;

	/**
	 * 将存储在本地的配置文件下发给指定的应用实例
	 * 
	 * @param id
	 * @param appId
	 * @param appInstId
	 * @return
	 * @throws IllegalAccessException
	 */
	ReplyInfo<Object> sync2(String id, String appId, String appInstId) throws IllegalAccessException;

	void clone(String appId, String fromEnv, String toEnv);

	void exportConfig(String appId, String fromEnv, String exportRoot) throws FileNotFoundException;

	void importConfig(String path) throws IOException;
}